package com.luck.pf.util;

import java.util.List;

import org.apache.log4j.Logger;

/**
 * 说明:
 * Copyright: Copyright (c) 2010
 * @author zhangwr 2011-8-12 上午08:53:00
 * @version 1.0
 */
public class Page {
	
	public static int PAGESIZE=20;
	private static final Logger logger = Logger.getLogger(Page.class);
	private List results;

	private int pageNo;
	
	private int pageAmount;

	private int pageSize;

	private int recordSize;

	public Page(List results, int pageNo, int pageSize, int recordSize) {
		this.results = results;
		this.pageNo = pageNo;
		this.pageSize = pageSize;
		this.recordSize = recordSize;
	}

	public Page() {
	}

    public void setResults(List results) {
        this.results = results;
    }
	public List getResults() {
		return this.results;
	}
	
	public int getPageNo() {
		return this.pageNo;
	}

	public int getPageSize() {
		return this.pageSize;
	}

	public boolean hasNext() {
		return this.pageNo < this.getPageAmount()? true : false;
	}

	public boolean hasPrevious() {
		return this.pageNo > 1 ? true : false;
	}
	
	public int getPageAmount() {
		return (int) Math.ceil((double) this.recordSize / this.pageSize);
	}

	public int getRecordSize() {
		return this.recordSize;
	}

	public void setPageAmount(int pageAmount) {
		this.pageAmount = pageAmount;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public void setRecordSize(int recordSize) {
		this.recordSize = recordSize;
	}

}